package com.deyuanyun.pic.pipe.controller.vo.merge;

import com.deyuanyun.pic.common.util.ObjectUtil;
import com.deyuanyun.pic.common.util.format.NumberFormat;
import com.deyuanyun.pic.pipe.controller.vo.BaseVO;
import com.deyuanyun.pic.pipe.controller.vo.BaseVOUtil;
import com.deyuanyun.pic.pipe.domain.Celbow;
import com.deyuanyun.pic.settings.support.biz.CodeUtil;
import com.deyuanyun.pic.settings.support.biz.PipeLineUtil;
import com.github.pagehelper.Page;

/**
 * 冷弯头信息表
 */
public class CelbowVO extends BaseVO<Celbow> {

    // 管道名称
    private String pipeLineName;
    // 弯头编号
    private String elbowNumber;
    // 钢管编号
    private String pipeNumber;
    // 上游环焊缝焊接编号
    private String ugwwId;
    // 下游环焊缝焊接编号
    private String dgwwId;
    // 绝对距离(m)
    private String mileage;
    // 相对最近参考点
    private String reference;
    // 相对最近参考点距离(m)
    private String referenceDistance;
    // 弯头角度(°）
    private String elbowAngle;
    // 曲率半径（D）
    private String elbowCurvrad;
    // 方向
    private String direction;
    // 曲线长
    private String curveLength;
    // 切线长
    private String tangentLength;
    // 弧长
    private String arcLength;
    // 防腐材料
    private String coatingmAterial;
    // 链接计算结果表
    private String gisId;

    public String getPipeLineName() {
        return pipeLineName;
    }

    public void setPipeLineName(String pipeLineName) {
        this.pipeLineName = pipeLineName;
    }

    public String getElbowNumber() {
        return elbowNumber;
    }

    public void setElbowNumber(String elbowNumber) {
        this.elbowNumber = elbowNumber;
    }

    public String getPipeNumber() {
        return pipeNumber;
    }

    public void setPipeNumber(String pipeNumber) {
        this.pipeNumber = pipeNumber;
    }

    public String getUgwwId() {
        return ugwwId;
    }

    public void setUgwwId(String ugwwId) {
        this.ugwwId = ugwwId;
    }

    public String getDgwwId() {
        return dgwwId;
    }

    public void setDgwwId(String dgwwId) {
        this.dgwwId = dgwwId;
    }

    public String getMileage() {
        return mileage;
    }

    public void setMileage(String mileage) {
        this.mileage = mileage;
    }

    public String getReference() {
        return reference;
    }

    public void setReference(String reference) {
        this.reference = reference;
    }

    public String getReferenceDistance() {
        return referenceDistance;
    }

    public void setReferenceDistance(String referenceDistance) {
        this.referenceDistance = referenceDistance;
    }

    public String getElbowAngle() {
        return elbowAngle;
    }

    public void setElbowAngle(String elbowAngle) {
        this.elbowAngle = elbowAngle;
    }

    public String getElbowCurvrad() {
        return elbowCurvrad;
    }

    public void setElbowCurvrad(String elbowCurvrad) {
        this.elbowCurvrad = elbowCurvrad;
    }

    public String getDirection() {
        return direction;
    }

    public void setDirection(String direction) {
        this.direction = direction;
    }

    public String getCurveLength() {
        return curveLength;
    }

    public void setCurveLength(String curveLength) {
        this.curveLength = curveLength;
    }

    public String getTangentLength() {
        return tangentLength;
    }

    public void setTangentLength(String tangentLength) {
        this.tangentLength = tangentLength;
    }

    public String getArcLength() {
        return arcLength;
    }

    public void setArcLength(String arcLength) {
        this.arcLength = arcLength;
    }

    public String getCoatingmAterial() {
        return coatingmAterial;
    }

    public void setCoatingmAterial(String coatingmAterial) {
        this.coatingmAterial = coatingmAterial;
    }

    public String getGisId() {
        return gisId;
    }

    public void setGisId(String gisId) {
        this.gisId = gisId;
    }

    @Override
    public void fromDomain(Celbow domain) {

        if (ObjectUtil.isEmptyAll(domain)) {
            return;
        }
        // 管道名称
        this.pipeLineName = PipeLineUtil.getPipeLineName(domain.getPipeLineId());
        // 弯头编号
        this.elbowNumber = domain.getElbowNumber();
        // 钢管编号
        this.pipeNumber = domain.getElbowNumber();
        // 绝对距离(m)
        this.mileage = NumberFormat.format(domain.getMileage(), NumberFormat.FMT_PLACES3);
        // 相对最近参考点
        this.reference = domain.getReference();
        // 相对最近参考点距离(m)
        this.referenceDistance = NumberFormat.format(domain.getReferenceDistance(), NumberFormat.FMT_PLACES3);
        // 弯头角度(°）
        this.elbowAngle = NumberFormat.format(domain.getElbowAngle());
        // 曲率半径（D）
        this.elbowCurvrad = NumberFormat.format(domain.getElbowCurvrad());
        // 方向
        this.direction = domain.getDirection();
        // 曲线长
        this.curveLength = NumberFormat.format(domain.getCurveLength());
        // 切线长
        this.tangentLength = NumberFormat.format(domain.getTangentLength());
        // 弧长
        this.arcLength = NumberFormat.format(domain.getArcLength());
        // 防腐材料
        this.coatingmAterial = CodeUtil.getName(domain.getCoatingmAterial());
        // 上游环焊缝焊接编号
        this.ugwwId = domain.getUgwwId();
        // 下游环焊缝焊接编号
        this.dgwwId = domain.getDgwwId();

        // 链接GIS结果表
        this.gisId = domain.getGisId();

        super.fromDomain(domain.getId(), domain.getRecorder(), domain.getRecordtime(), domain.getCreateRemark());
    }

    public Page<CelbowVO> fromDomainList(Page<Celbow> domainList) {
        Page<CelbowVO> list = new Page<CelbowVO>();
        for (Celbow celbow : domainList) {
            CelbowVO celbowVO = new CelbowVO();
            celbowVO.fromDomain(celbow);
            list.add(celbowVO);
        }
        BaseVOUtil.converterPage(domainList, list);
        return list;
    }
}